using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

public class ItemUI : MonoBehaviour
{
    public Image iconImage;
    public  TextMeshProUGUI itemNameText;
    public   TextMeshProUGUI itemTypeText;
    public  TextMeshProUGUI itemInfoText;
    public TextMeshProUGUI itemHeldText;
    public int id;

    private ItemSO itemSO;

    private void Start()
    {
        UpdateHeldText(itemSO);
    }

    public void InitItem(ItemSO itemSO, Sprite iconSprite, string name, string type, string info)//对物品进行初始化
    {
        this.itemSO = itemSO;
        iconImage.sprite = itemSO.itemIcon;
        itemNameText.text = name;
        itemTypeText.text = type;
        itemInfoText.text = info;
        id = itemSO.itemID;
    }

    public void UpdateHeldText(ItemSO itemSO)
    {
        itemHeldText.text = itemSO.itemHeld.ToString();
    }
}
